import axios from "axios";
import { useLoginUserStore } from "@/stores/loginUser";


const instanse = axios.create()

instanse.interceptors.request.use(function (config) {
    const loginUserStore = useLoginUserStore()
if(loginUserStore.isLogin())
    // instanse.defaults.headers.common['Authorization'] = 'Bearer ' + loginUserStore.getToken();
    // config.headers.common['Authorization'] = 'Bearer ' + loginUserStore.getToken();
    config.headers.Authorization = 'Bearer ' + loginUserStore.getToken();
    return config;
  }, function (error) {
    // 对请求错误做些什么
    return Promise.reject(error);
});
export default instanse